package com.demo.Mapper;

import com.demo.DemoApplicationTests;
import com.demo.mapper.nengxiaoyujing.nengxiaoyujingMapper;
import com.demo.model.nengxiaoyujing.nengxiaoyujing;
import com.demo.model.nengxiaoyujing.nengxiaoyujingQ.nengxiaoyujingQ;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;


public class nxyjMapper extends DemoApplicationTests {


      @Autowired
      private nengxiaoyujingMapper nengxiaoyujingMapper;


    @Test
    public void  Test(){
        System.out.println("测试");
    }

    @Test
    public void all(){
        nengxiaoyujingQ nengxiaoyujingQ=new nengxiaoyujingQ();
//        nengxiaoyujingQ.setPointName("测试");
        nengxiaoyujingQ.setCheckpointAddress("地址");
        List<nengxiaoyujing> list=nengxiaoyujingMapper.findAll(nengxiaoyujingQ);
        list.forEach(System.out::println);
    }


    @Test
    public void update(){
        nengxiaoyujing nengxiaoyujing=new nengxiaoyujing();
        nengxiaoyujing.setId(3);
        nengxiaoyujing.setPointName("测试修改");
        nengxiaoyujing.setCheckpointAddress("测试修改地址");
        nengxiaoyujing.setRealtimePower(111);
        nengxiaoyujing.setRealtimeVoltage(321);
        nengxiaoyujing.setRemark("测试修改用例");
       int i= nengxiaoyujingMapper.update(nengxiaoyujing);
        System.out.println(i);
    }


    @Test
    public void del(){;
        int i=nengxiaoyujingMapper.delById(3);
        System.out.println(i);
    }

    @Test
    public void delall(){
        Integer ids[]=new Integer[]{4,5};
        int i=nengxiaoyujingMapper.delByIdIn(ids);
        System.out.println(i);
    }


    @Test
    public void save(){
        nengxiaoyujing nengxiaoyujing=new nengxiaoyujing();
        nengxiaoyujing.setPointName("测试添加66");
        nengxiaoyujing.setCheckpointAddress("测试添加地址");
        nengxiaoyujing.setRealtimePower(789);
        nengxiaoyujing.setRealtimeVoltage(123);
        nengxiaoyujing.setStatus(1);
        nengxiaoyujing.setRemark("备注2");
        nengxiaoyujing.setReportingTime(null);
       int i= nengxiaoyujingMapper.save(nengxiaoyujing);
        System.out.println(i);
    }

    @Test
    public void count(){
        nengxiaoyujingQ nengxiaoyujingQ=new nengxiaoyujingQ();
//        nengxiaoyujingQ.setPointName("测试");
        nengxiaoyujingQ.setPointName("测试");
        int i=nengxiaoyujingMapper.countNumber(nengxiaoyujingQ);
        System.out.println(i);
    }
}


